﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Portal/Master/Portal.Master" AutoEventWireup="true"
    CodeBehind="OrderPay.aspx.cs" Inherits="Besture.UI.Portal.Pay.OrderPay" %>

<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="Content" runat="server">
    <div class="main">
        <div class="order_top">
            <div class="order_top_body">
                <div class="order_top_content">
                    <img src="../../Resource/images/title1.png" />
                    <p>
                        填写订单</p>
                </div>
                <div class="order_top_xian">
                    <div class="xian">
                    </div>
                </div>
                <div class="order_top_content">
                    <img src="../../Resource/images/title2.png" />
                    <p>
                        核对信息</p>
                </div>
                <div class="order_top_xian">
                    <div class="xian">
                    </div>
                </div>
                <div class="order_top_content">
                    <img src="../../Resource/images/title3.png" />
                    <p>
                        等待确认</p>
                </div>
                <div class="order_top_xian">
                    <div class="xian">
                    </div>
                </div>
                <div class="order_top_content">
                    <img src="../../Resource/images/title4_4.png" />
                    <p class="act">
                        支付</p>
                </div>
                <div class="order_top_xian">
                    <div class="xian">
                    </div>
                </div>
                <div class="order_top_content">
                    <div class="bor">
                        <img src="../../Resource/images/title5.png" />
                    </div>
                    <p>
                        完成</p>
                </div>
            </div>
            <div class="left">
            </div>
            <div class="right">
            </div>
        </div>
        <form>
        <div class="pay_main">
            <div class="order_main">
                <div class="order_main_top">
                    <a href="../Home/Index.aspx">首页</a> > <a href="../Hotel/Product.aspx">酒店列表</a> >
                    <asp:Label ID="lblHotelName1" CssClass="grog" runat="server"></asp:Label>
                </div>
                <div class="order_left">
                    <div class="order_main_body2">
                        <!--<div class="order_main_body_content3">
                                <span class="date">房&nbsp;&nbsp;&nbsp;&nbsp;型</span> <span class="oldtime">豪华房</span>
                            </div>-->
                        <div class="order_main_body">
                            <div class="order_main_body_top">
                                订单信息</div>
                            <div class="order_main_body_content">
                                <span class="date">酒店名称：</span><asp:Label ID="lblHotelName2" CssClass="oldtime" runat="server"></asp:Label>
                            </div>
                            <div class="order_main_body_content">
                                <span class="date">入住日期：</span>
                                <asp:Label ID="lblBeginTime" CssClass="time" runat="server"></asp:Label>&nbsp;&nbsp;<asp:Label
                                    ID="lblDay1" CssClass="time" runat="server"></asp:Label>
                            </div>
                            <div class="order_main_body_content">
                                <span class="date">离店日期：</span>
                                <asp:Label ID="lblEndTime" CssClass="time" runat="server"></asp:Label>&nbsp;&nbsp;<asp:Label
                                    ID="lblDay2" CssClass="time" runat="server"></asp:Label>
                            </div>
                            <div class="order_main_body_content">
                                <span class="date">房&nbsp;&nbsp;&nbsp;&nbsp;型：</span><asp:Label ID="lblRoomName"
                                    runat="server"></asp:Label>&nbsp;&nbsp;房费：￥<asp:Label ID="lblPrice" CssClass="money"
                                        runat="server"></asp:Label>
                            </div>
                            <div class="order_main_body_content">
                                <span class="date">房间数量：</span><asp:Label ID="lblRoomNum" CssClass="oldtime" runat="server">间</asp:Label>
                            </div>
                            <div class="order_main_body_content">
                                <span class="date">住客姓名：</span><asp:Label ID="lblUserName" CssClass="oldtime" runat="server"></asp:Label>
                            </div>
                            <div class="order_main_body_content">
                                <span class="date">最晚抵店：</span><asp:Label ID="lblArrive" CssClass="oldtime" runat="server"></asp:Label>
                            </div>
                            <div class="order_main_body_content">
                                <span class="date">会员抵扣价：</span><asp:Label ID="lblNightPrice" CssClass="np" runat="server"></asp:Label>&nbsp;元
                            </div>
                            <div class="order_main_body_content">
                                <span class="date">订&nbsp;单&nbsp;号：</span><asp:Label ID="lblOrderNo" CssClass="money"
                                    runat="server"></asp:Label>
                            </div>
                            <div class="vip">
                                <div class="left">
                                    <asp:CheckBox ID="ckUserScore" runat="server"/>&nbsp;使用积分&nbsp;<asp:TextBox ID="txtScore"
                                        runat="server"></asp:TextBox>&nbsp;&nbsp;点&nbsp;&nbsp;-￥<asp:Label ID="lblScorePrice"
                                            runat="server"></asp:Label>&nbsp;&nbsp;&nbsp;&nbsp;（可用<asp:Label ID="lblScore" runat="server"></asp:Label>点）
                                </div>
                                <div class="right" style="padding: 0 16px;">
                                    应付金额&nbsp;￥<asp:Label ID="lblActuallyPaidPrice" runat="server"></asp:Label></div>
                                <asp:HiddenField runat="server" ID="hfIntegration" />
                                <asp:HiddenField runat="server" ID="hfIntegrationRMB" />
                            </div>
                            <br class="clear" />
                        </div>
                        <div class="pay_way">
                            <div class="pay_way_top">
                                支付方式</div>
                            <div class="pay_way_body">
                                <div class="content">
                                    <input type="radio" name="radioPayTyple" checked="checked" /><img src="../../Resource/images/pay1.png" /></div>
                                <div class="content">
                                    <input type="radio" name="radioPayTyple" /><img src="../../Resource/images/pay3.png" class="img_2" /></div>
                            </div>
                        </div>
                    </div>
                    <br class="clear" />
                    <div class="order_floot pay-foot">
                        <input id="btnSave" type="button" class="submt" value="确认提交" />
                    </div>
                </div>
            </div>
            </div>
        </form>
        <br class="clear" />
    </div>
    <!-- //main -->
    <script type="text/javascript">
        $(".vip input[type=checkbox]").change(function () {
            var price = $(".money:eq(0)").text() - $(".np").text();
            if ($(this).attr("checked")) {
                if ($(".vip input[type=text]").val().length > 0) {
                    // var score = $(".vip input[type=text]").val();
                    var su = ($(".vip input[type=text]").val());
                    var sc = ($(".vip .left span:eq(1)").text());
                    if (su > sc) {
                        su = sc;
                        $(".vip input[type=text]").val(sc);
                    }
                    var hfit = $(".vip input[type=hidden]").eq(0).val();
                    var hfrmb = $(".vip input[type=hidden]").eq(1).val();
                    var dc = (su / hfit * hfrmb).toFixed(2);
                    $(".vip .left span:eq(0)").text(dc);
                    $(".vip .right span:eq(0)").text(price - $(".vip .left span:eq(0)").text());
                }
            } else {
                $(".vip input[type=text]").val("");
                $(".vip .left span:eq(0)").text("0");
                $(".vip .right span:eq(0)").text(price);
            }
        });
        
        $(".vip input[type=text]").keyup(function () {
            if ($(".vip input[type=checkbox]").attr("checked")) {
                var price = $(".money:eq(0)").text() - $(".np").text();
                var su = parseInt($(this).val());
                var sc = parseInt($(".vip .left span:eq(1)").text());
                if (su > sc) {
                    su = sc;
                    $(".vip input[type=text]").val(sc);
                }
                var hfit = $(".vip input[type=hidden]").eq(0).val();
                var hfrmb = $(".vip input[type=hidden]").eq(1).val();
                var dc = (su / hfit * hfrmb).toFixed(2);
                if (hfit > 0) {
                    $(".vip .left span:eq(0)").text(dc);
                    $(".vip .right span:eq(0)").text(price - $(".vip .left span:eq(0)").text());
                }
            }
        });

        $("#btnSave").click(function () {
            $.ajax({
                type: "POST",
                url: "OrderPay.aspx/SaveOrder",
                data: "{ 'on': '" + $(".money:eq(1)").text() + "','ci':'" + $(".vip input[type=text]").val() + "','dp':'" + $(".vip .left span:eq(0)").text() + "','np':'" + $(".np").text() + "','ap':'" + $(".vip .right span:eq(0)").text() + "','payMethod':'" + 0 + "'}",
                contentType: "application/json",
                success: function (msg) {
                    if (msg.d == 1) {
                        window.location.href = "OrderSuccess.aspx";
                    } else {
                        alert("超时，请重新登录！");
                        window.location.href = "../UserCenter/Login.aspx";
                    }
                }
            }); 
        });
    </script>
</asp:Content>
